package cn.scxy.bookcity.service.impl;

import cn.scxy.bookcity.ex.ServiceException;
import cn.scxy.bookcity.mapper.PressMapper;
import cn.scxy.bookcity.pojo.vo.PressStandardVO;
import cn.scxy.bookcity.service.IPressService;
import cn.scxy.bookcity.web.ServiceCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
@Slf4j
public class PressServiceImpl implements IPressService {

    @Autowired
    private PressMapper pressMapper;
    @Override
    public PressStandardVO queryPress(Integer id) {
        PressStandardVO pressStandardVO = pressMapper.queryPress(id);
        if (pressStandardVO == null){
            String message = "查询失败,查询的出版社不存在!";
            log.debug(message);
            throw new ServiceException(ServiceCode.ERR_NOT_FOUND, message);
        }
        return pressStandardVO;
    }
}
